<?php

/**
 * 微擎支付宝小程序
 * [WeEngine System] Copyright (c) 2013 WE7.CC
 * Date: 2017/12/10
 * Time: 14:46.
 */
class Demo_aliappModuleAliapp extends WeModuleAliapp {

	private $uid; // 用户ID
	public function __construct() {
		global $_W, $_GPC;
		$this->uniacid = $_W['uniacid'];
	}

	public function doPageList() {
		$data = pdo_getall('demo_aliapp_riji', array('uniacid'=>$this->uniacid),'', 'orderBy createtime desc');
		$this->result(0, '待办列表', $data);
	}

	public function doPageInsert() {
		global $_GPC;
		$todo = safe_gpc_string($_GPC['todo']);
		$result = pdo_insert('demo_aliapp_riji', array('uniacid' => $this->uniacid, 'completed' => false, 'createtime' => time(), 'title' => $todo));
		if ($result) {
			$this->result(0, '添加成功', true);
		} else {
			$this->result(-1, '添加失败', false);			
		}
	}

}
